<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateLearnVideoSectionsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('learn_video_sections', function (Blueprint $table) {
            $table->id();
            $table->integer('learn_video_id', false, true)->index()->comment('视频id');
            $table->integer('learn_video_chapter_id', false, true)->index()->comment('视频章id');
            $table->string('name')->comment('名称');
            $table->bigInteger('total_size')->default(0)->index()->comment('文件大小,kb');
            $table->bigInteger('total_second')->default(0)->index()->comment('总秒数');
            $table->string('video_format')->index()->comment('视频格式');
            $table->text('video_url')->comment('视频链接');
            $table->string('thumb')->nullable()->comment('视频封面');
            $table->integer('sort')->default(0)->index()->comment('排序值');
            $table->timestamps();
        });

        DB::statement("ALTER TABLE learn_video_sections comment '学习视频节'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('learn_video_sections');
    }
}
